/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2019
 */

package net.dreamlu.db.po;


import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.format.annotation.DateTimeFormat;


import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
 *
 * @author lambert.wang email:lambert.wang(a)crediteyes.com
 * @version 1.0
 * @since 1.0
 */
@Data
@Slf4j
@Entity
@Table(name = "t_blog")
public class Blog implements Serializable {
	private static final long	serialVersionUID	= 5454155825314635342L;
	//alias
	public static final String TABLE_ALIAS = "Blog";
	public static final String ALIAS_ID = "id";
	public static final String ALIAS_CONTENT = "内容";
	public static final String ALIAS_CREATE_TIME = "创建时间";
	public static final String ALIAS_FEATURED = "featured";
	public static final String ALIAS_PRIVACY = "privacy";
	public static final String ALIAS_STATUS = "status";
	public static final String ALIAS_SUMMARY = "summary";
	public static final String ALIAS_TAGS = "tags";
	public static final String ALIAS_TITLE = "title";
	public static final String ALIAS_VIEWS = "views";
	public static final String ALIAS_AUTHOR_ID = "authorId";
	public static final String ALIAS_CATEGORY_ID = "categoryId";
	
	public static final String PROP_ID = "id";
	public static final String PROP_CONTENT = "content";
	public static final String PROP_CREATE_TIME = "createTime";
	public static final String PROP_FEATURED = "featured";
	public static final String PROP_PRIVACY = "privacy";
	public static final String PROP_STATUS = "status";
	public static final String PROP_SUMMARY = "summary";
	public static final String PROP_TAGS = "tags";
	public static final String PROP_TITLE = "title";
	public static final String PROP_VIEWS = "views";
	public static final String PROP_AUTHOR_ID = "authorId";
	public static final String PROP_CATEGORY_ID = "categoryId";
	//columns START
    /**
     * id       db_column: id 
     */ 	
	@Id 
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true, length = 20)
	private java.lang.Long id;
    /**
     * 内容       db_column: content 
     */ 	
	@Column(name = "content", unique = false, nullable = true, insertable = true, updatable = true, length = 2147483647)
	private java.lang.String content;
    /**
     * 创建时间       db_column: create_time 
     */ 	
	@CreatedDate				
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
	@Column(name = "create_time", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
	private java.time.LocalDateTime createTime;
    /**
     * featured       db_column: featured 
     */ 	
	@Column(name = "featured", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	private java.lang.Integer featured;
    /**
     * privacy       db_column: privacy 
     */ 	
	@Column(name = "privacy", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	private java.lang.Integer privacy;
    /**
     * status       db_column: status 
     */ 	
	@Column(name = "status", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	private java.lang.Integer status;
    /**
     * summary       db_column: summary 
     */ 	
	@Column(name = "summary", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	private java.lang.String summary;
    /**
     * tags       db_column: tags 
     */ 	
	@Column(name = "tags", unique = false, nullable = true, insertable = true, updatable = true, length = 255)
	private java.lang.String tags;
    /**
     * title       db_column: title 
     */ 	
	@Column(name = "title", unique = false, nullable = true, insertable = true, updatable = true, length = 255)
	private java.lang.String title;
    /**
     * views       db_column: views 
     */ 	
	@Column(name = "views", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	private java.lang.Integer views;
    /**
     * authorId       db_column: author_id 
     */ 	
	@Column(name = "author_id", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
	private java.lang.Long authorId;
    /**
     * categoryId       db_column: category_id 
     */ 	
	@Column(name = "category_id", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	private java.lang.Integer categoryId;
	//columns END
	@Override
	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.JSON_STYLE)
			.append(PROP_ID,getId())
			.append(PROP_CONTENT,getContent())
			.append(PROP_CREATE_TIME,getCreateTime())
			.append(PROP_FEATURED,getFeatured())
			.append(PROP_PRIVACY,getPrivacy())
			.append(PROP_STATUS,getStatus())
			.append(PROP_SUMMARY,getSummary())
			.append(PROP_TAGS,getTags())
			.append(PROP_TITLE,getTitle())
			.append(PROP_VIEWS,getViews())
			.append(PROP_AUTHOR_ID,getAuthorId())
			.append(PROP_CATEGORY_ID,getCategoryId())
			.toString();
	}
	@Override
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Blog == false) return false;
		if(this == obj) return true;
		Blog other = (Blog)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	
}
